
export function billChartsOptions(param) {
  return {
    legend: {},
    tooltip: {},
    dataset: {
      source: param
    },
    xAxis: [
      {type: 'category', gridIndex: 0},
      {type: 'category', gridIndex: 1}
    ],
    yAxis: [
      {gridIndex: 0},
      {gridIndex: 1}
    ],
    grid: [
      {bottom: '55%'},
      {top: '55%'}
    ],
    series: [
      // These series are in the first grid.
      {type: 'bar', seriesLayoutBy: 'row'},
      {type: 'bar', seriesLayoutBy: 'row'},
      {type: 'bar', seriesLayoutBy: 'row'},
      {type: 'bar', seriesLayoutBy: 'row'},
      // These series are in the second grid.
      {type: 'bar', xAxisIndex: 1, yAxisIndex: 1},
      {type: 'bar', xAxisIndex: 1, yAxisIndex: 1},
      {type: 'bar', xAxisIndex: 1, yAxisIndex: 1},
      {type: 'bar', xAxisIndex: 1, yAxisIndex: 1}
    ]
  };
}

export function stockDataChartsOptions(param) {
  return {
    tooltip: {
      trigger: 'axis',
      axisPointer: {            // 坐标轴指示器，坐标轴触发有效
        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
      }
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: [
      {
        type: 'category',
        data: ['昨天', '前天', '前三天', '前四天', '前五天', '前六天', '前七天'],
        axisTick: {
          alignWithLabel: true
        }
      }
    ],
    yAxis: [
      {
        type: 'value'
      }
    ],
    series: [
      {
        name: '入库',
        type: 'bar',
        data: param.inStock
      },{
        name: '移库',
        type: 'bar',
        data: param.tran
      },{
        name: '退库',
        type: 'bar',
        data: param.outStock
      }
    ]
  };
}

export function stockDayChartsOptions(param) {
  return {
    tooltip: {
      trigger: 'item'
    },
    legend: {
      top: '5%',
      left: 'center'
    },
    series: [
      {
        name: '',
        type: 'pie',
        radius: ['40%', '70%'],
        avoidLabelOverlap: false,
        itemStyle: {
          borderRadius: 10,
          borderColor: '#fff',
          borderWidth: 2
        },
        label: {
          show: false,
          position: 'center'
        },
        emphasis: {
          label: {
            show: true,
            fontSize: '40',
            fontWeight: 'bold'
          }
        },
        labelLine: {
          show: false
        },
        data: param
      }
    ]
  };
}

export function stepChartsOptions(options) {
  let option = {
    title: {
      text: '最近七天数据表'
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: ['供应商', '小程序用户', '待验机', '待报价', '待入库']
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: ['昨天', '前天', '前三天', '前四天', '前五天', '前六天', '前七天'],
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        name: '供应商',
        type: 'line',
        smooth: true,
        data: options.supplier
      },
      {
        name: '小程序用户',
        type: 'line',
        smooth: true,
        data: options.user
      },
      {
        name: '待验机',
        type: 'line',
        smooth: true,
        data: options.stand
      },
      {
        name: '待报价',
        type: 'line',
        smooth: true,
        data: options.offer
      },
      {
        name: '待入库',
        type: 'line',
        smooth: true,
        data: options.stock
      }
    ]
  };
  return option;
}

export function standChartsOptions(options) {
  let option = {
    title: {
      text: '最近七天数据表'
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: ['验机数', '被驳回数']
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: ['昨天', '前天', '前三天', '前四天', '前五天', '前六天', '前七天'],
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        name: '验机数',
        type: 'line',
        smooth: true,
        data: options.stand
      },
      {
        name: '被驳回数',
        type: 'line',
        smooth: true,
        data: options.reject
      }
    ]
  };
  return option;
}

export function userChartsOptions(options) {
  return  {
    title: {
      text: '最近七天数据表'
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: ['访问用户', '新增用户', '回收订单', '消费订单', '回收退单', '消费退单']
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: ['昨天', '前天', '前三天', '前四天', '前五天', '前六天', '前七天'],
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        name: '访问用户',
        type: 'line',
        smooth: true,
        data: options.visitUser
      },
      {
        name: '新增用户',
        type: 'line',
        smooth: true,
        data: options.addUser
      },
      {
        name: '回收订单',
        type: 'line',
        smooth: true,
        data: options.collectOrder
      },
      {
        name: '消费订单',
        type: 'line',
        smooth: true,
        data: options.saleOrder
      },
      {
        name: '回收退单',
        type: 'line',
        smooth: true,
        data: options.colOut
      },
      {
        name: '消费退单',
        type: 'line',
        smooth: true,
        data: options.saleOut
      }
    ]
  };
}

export function storeChartsOptions(options) {
  let option = {
    title: {
      text: '最近七天数据表'
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: ['回收数量', '回收金额',]
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: ['昨天', '前天', '前三天', '前四天', '前五天', '前六天', '前七天'],
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        name: '回收数量',
        type: 'line',
        smooth: true,
        data: options.number
      },
      {
        name: '回收金额',
        type: 'line',
        smooth: true,
        data: options.price
      }]
  };
  return option;
}
